<template>
	<view class="container">
		<view class="boxitem" v-for="item in list" v-if="list.length>0">
			<view>{{item.name}}</view>
			<view class="djxg" @click="handledjxg(item)">{{app.language.djxg}}</view>
		</view>
		<view class="list" v-if="list.length==0">
			<nullVue></nullVue>
		</view>
	</view>
</template>

<script>
	import graceChecker from "../../components/graceChecker.js"
	import nullVue from '@/components/null';
	import {
		getHous
	} from '@/api/form.js'
	const global = getApp().globalData;
	import config from '@/config.js'
	import AreaPicker from '@/components/areapicker.vue';
	export default {
		components: {
			nullVue
		},
		data() {
			return {
				app: {
					global: global,
					name: global.appName,
					language: global.language
				},
				token:"",
				list:[]
			}
		},
		onLoad() {
			this.getToken()
			setTimeout(() => {
				this.getlist()
			  }, 100); // 2000毫秒
		},
		methods: {
			// 获取缓存
			getToken() {
				uni.showLoading({
					title: this.app.language.jzz
				});
				let that = this
				uni.getStorage({
					key: 'loginData',
					success: function(res) {
						that.token = res.data.userInfo.appToken
						console.log('that.token',that.token)
						uni.hideLoading();
						console.log('that.form', that.form)
					}
				});
			},
			
			
			// 获取数据列表
			getlist(){
				uni.showLoading({
					title: this.app.language.jzz
				});
				let data = {
					appToken:this.token
				}
				getHous(data).then((res) => {
					if (res.code == 200) {
						this.list = res.data
						uni.hideLoading();
					}
				})
			},
			
			// 去修改
			handledjxg(item){
				uni.navigateTo({
					url: '../rentHouse/index?id='+item.uuid,
				});
				
			}
		},
	}
</script>

<style>
	.boxitem{
		display: flex;
		border-bottom: 1px dashed #ddd;
		margin-bottom: 10rpx;
		padding: 20rpx;
	}
	
	.djxg{
		margin-left: auto;
		border: 1px solid #2270f3;
		font-size: 22rpx;
		padding:5rpx 15rpx;
		text-align: center;
		color: #2270f3;
		border-radius: 5rpx;
	}
</style>